package cn.pli.bike.ui;

import android.support.v7.widget.RecyclerView;
import android.widget.CheckBox;
import android.widget.TextView;

import cn.bingoogolapple.androidcommon.adapter.BGARecyclerViewAdapter;
import cn.bingoogolapple.androidcommon.adapter.BGAViewHolderHelper;
import cn.pli.bike.R;
import cn.pli.bike.bean.BadErrBean;

/**
 * Created by shangdongzhou on 2017/12/6.
 */

public class ProblemTypeAdapter extends BGARecyclerViewAdapter<BadErrBean> {
    int selectPosition = 0;

    public ProblemTypeAdapter(RecyclerView recyclerView) {
        super(recyclerView, R.layout.item_problem_type);
    }

    @Override
    protected void fillData(BGAViewHolderHelper helper, int position, BadErrBean model) {
        CheckBox cbTitle = helper.getView(R.id.cb_problem_title);
        cbTitle.setText(model.getTypeName());
        cbTitle.setChecked(selectPosition == position);
    }

    public void setSelectPosition(int selectPosition) {
        this.selectPosition = selectPosition;
        notifyDataSetChangedWrapper();
    }

    public int getSelectPosition() {
        return selectPosition;
    }

    @Override
    protected void setItemChildListener(BGAViewHolderHelper helper, int viewType) {
        super.setItemChildListener(helper, viewType);
        helper.setItemChildClickListener(R.id.cb_problem_title);


    }
}
